import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 98152
 * Date: 2024-10-19
 * Time: 9:36
 */
public class Test1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int q = in.nextInt();
        int[] result = new int[q];
        for(int i = 0; i < q; i++) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            int minAB = Math.min(a,b);
            int minBC = Math.min(b,c);
            int min = Math.min(minAB, minBC);
            int grade = 0;
            if(min != 0) {
                grade += min*2;
                a -= min;
                b -= min;
                c -= min;
            }
            if(b != 0) {
                grade += b-1;
            }
            result[i] = grade;
        }
        for(int x : result) {
            System.out.println(x);
        }
    }
}
